from django.shortcuts import render, HttpResponse
from django.views import View
from rest_framework.views import APIView

# Create your views here.

# class BookView(View):
#     def dispatch(self, request, *args, **kwargs):
#         print('hello')
#         return super().dispatch(request, *args, **kwargs)
#
#     def get(self, request):
#         return HttpResponse('GET请求')
#
#     def post(self, request):
#         return HttpResponse('POST请求')


class BookView(APIView):
    def get(self, request):
        print(request.query_params)
        return HttpResponse('APIview GET请求')

    def post(self, request):
        print(request.data)
        return HttpResponse('Apiview POST请求')